package afcp.alumni.file;


public class IncorrectLineException extends IllegalStateException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public IncorrectLineException(String[] line) {
		super("La ligne du fichier CSV a un format incorrect. Contenu trouvé après analyse: " + lineArrayToString(line));
	}
	
	private static String lineArrayToString(String[] line) {
		StringBuilder lineBuilder = new StringBuilder();
		for (int i=0;i<line.length;i++) {
			if (i!=0) {
				lineBuilder.append(", ");
			}
			lineBuilder.append(line[i]);
		}
		return lineBuilder.toString();
	}

}
